package org.osami.gateway.type;

public class Temperature {

    /**
     * Temperature.
     */
    private double temperature;

    private String gatewayId;

    private Unit unit;

    public Temperature(double temperature) {
        this(temperature, "default");
    }

    public Temperature(double temperature, String gatewayId) {
        this(temperature, gatewayId, Unit.CELSIUS);
    }

    public Temperature(double temperature, String gatewayId, Unit unit) {
        this.temperature = temperature;
        this.gatewayId = gatewayId;
        this.unit = unit;
    }

    /**
     * The source of the temperature.
     */
    public String getGatewayId() {
        return gatewayId;
    }

    /**
     * The temperature value.
     */
    public double getTemperature() {
        return temperature;
    }

    /**
     * The temperature unit
     */
    public Unit getUnit() {
        return unit;
    }

    public static enum Unit {
        KELVIN, CELSIUS, FAHRENHEIT
    }

    /*
     * (non-Javadoc)
     * @see java.lang.Object#toString()
     */
    @Override
    public String toString() {
        return getGatewayId() + ", Temperature: " + getTemperature() + " " + getUnit();
    }
}
